package com.zzjson.strategy.config;

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import com.zzjson.strategy.config.SourcesPropertyDecoder.DESSourcesPropertyDecoder;

import java.io.IOException;
import java.util.Properties;

public class CustomizedPropertySourcesPlaceholderConfigurer extends PropertySourcesPlaceholderConfigurer {

    private SourcesPropertyDecoder decoder = new DESSourcesPropertyDecoder();

    @Override
    protected String convertPropertyValue(String originalValue) {
        return decoder.decode(originalValue);
    }

    @Override
    protected Properties mergeProperties() throws IOException {
        Properties mergedProps = super.mergeProperties();
        convertProperties(mergedProps);
        return mergedProps;
    }
}
